package STUDENT.NGUYENHUUTHANG.STRUCTURE_PROGRAMMING.EXAMPLES;

import java.util.Scanner;

public class chan_le {

	public static void main(String[] args) {
		System.out.println("Ban hay nhap mot so tu nhien: ");
		Scanner sc = new Scanner(System.in);
		String x = sc.nextLine();
		if (x.isEmpty()) {
			System.out.println("Ban chua nhap so a!");

		} else {
			int a = Integer.parseInt(x);
			if (a < 0) {
				System.out.println("Ban nhap sai so a!");
			} else
				System.out.println("Chon kieu: ");
			String y = sc.nextLine();
			if (y.isEmpty() || (y.equals("chan") == false && y.equals("le") == false)) {
				System.out.println("Ban chua nhap hoac nhap sai kieu!");
			} else {
				if (y.equals("chan")) {
					System.out.println("In ra cac so chan tu 0 den " + a);
					int dem_chan = 0;
					for (int i = 0; i <= a; i++) {
						if (i % 2 == 0) {
							dem_chan++;							
							System.out.println(i);
						}
					}
					System.out.println("Co " + dem_chan + " so chan");

				}
				if (y.equals("le")) {
					System.out.println("In ra cac so le tu 0 den " + a);
					int dem_le = 0;
					for (int j = 0; j <= a; j++) {
						if (j % 2 == 1) {
							dem_le++;
							System.out.println(j);
						}
					}
					System.out.println("Co " + dem_le + " so le");
				}
			}

		}

	}
}
